﻿#define _CRT_SECURE_NO_WARNINGS 1
//给你⼀个⾮负整数 x ，计算并返回 x 的算术平⽅根。
//由于返回类型是整数，结果只保留整数部分，⼩数部分将被舍去。
//注意：不允许使⽤任何内置指数函数和算符，例如 pow(x, 0.5) 或者 x** 0.5 。
//eg：输⼊：x = 4 输出：2

#include <iostream>
using namespace std;

//转化为二分查找问题，再整个int范围中查找满足mid*mid=x的mid值
unsigned int mySqrt1(unsigned int x)
{
	long long mid = 0;
	for (unsigned int left = 0, right = INT_MAX; left <= right;)
	{
		mid = left + (right - left) / 2;
		if (x > mid * mid)
			left = mid + 1;
		else if (x < mid * mid)
			right = mid - 1;
		else
			return mid;
	}
	return x > mid * mid ? mid : mid -1;
}

unsigned int mySqrt2(unsigned int x)
{
	long long mid = 0;
	unsigned int left = 0, right = x;
	while (left < right)
	{
		mid = left + (right - left+1) / 2;
		if (mid * mid <= x)
			left = mid;
		else
			right = mid - 1;
	}
	return left;
}

int main()
{
	unsigned int x = 0;
	cin >> x;
	unsigned int an =mySqrt2(x);
	cout << an << endl;

	return 0;
}